package sort;

import java.util.*;

public class Test {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int len = n;
            Integer[] array = new Integer[len];
            int index = 0;
            while (index < len) {
                array[index++] = sc.nextInt();
            }

            long result = 0;
            Arrays.sort(array);
            Set<Integer> set = new HashSet<Integer>();

            for (int i = len - 1; i >= 0; i--) {
                int tempValue = array[i];
                while (set.contains(tempValue)) {
                    tempValue--;
                }
                set.add(tempValue);
                result += tempValue;
            }
            System.out.println(result);
        }
    }

}
